{% extends 'base_de.html' %}
{% block styles %}
{{ style }}
{% endblock %}
<div id=wrapper>
  {% block page_header %}
  <div id=header>
    {% if own_logo %}
	<img src="{{ own_logo }}">
    {% else %}
	<h1>{{ own_company_name }}</h1>
    {% endif %}
  </div>
  {% endblock page_header %}

  {% block addressblock %}

    <div id=info>
      <div id=absenderzeile>
	<p>{{own_company_name}}, {{own_address1}}, {{own_company_zip}} {{own_citiy}}</p>
      </div><!-- END of absenderzeile-->
      <div id=empfaengerzeile>
	<p>
	  {% if company_name %}{{company_name}}<br>{% endif %}{% if company_additional %}{{company_additional}}<br>{% endif %}{% if person_firstname %}{{person_firstname}} {% endif %}{% if person_lastname %}{{person_lastname}}<br>{% endif %}{% if additional_address_info %}{{additional_address_info}}<br>{% endif %}{% if street_box %}{{street_box}}<br>{% endif %}{% if address_zip %}{{address_zip}} {% endif %}{% if address_city %}{{address_city}}<br>{% endif %}{% if address_country %}{{address_country}}{% endif %}
	</p>
      </div><!-- END of Empfängerzeile-->
      <div id=infoblock align="left" >
	<p>
	  {{own_address1}}<br>{{own_zip}} {{own_citiy}}<br>
	</p>
	<p>
	  {{own_email}}<br>{{own_website}}
	</p>
	<p>
	  {{own_bank}}<br>{{own_IBAN}}<br>{{own_BIC}}
	</p>
	<p>
	  {% if supplyer_id %}Unsere Lieferanten-ID:{{supplyer_id}}{% endif %}
	  <br>
	  {% if customer_number %}Ihre Kundennummer:{{"%04s" %customer_number}}{% endif %}
	</p>
	<p> 
	  <h2>{% if canceled %}CANCELED{% endif %}</h2>
	</p>
      <br>

      </div><!--End of Infoblock-->


    </div><!-- END of info-->

  {% endblock addressblock %}



  {% block contentblock %}

    <div id=content>
      <h1>{{voucher_type_name}} {{"%04i" %voucher_number}}</h1>
	{% if pre_text %}
	  <div id=pre_text>
	    <p>{{pre_text}}</p>
	  </div><!-- END of pre_text-->
	{% endif %}
	
      <div id=belegdetails>
	<table border = 1 width=100% align=right><!-- this one should have a border-->
	  <tr>
	    <td>Belegdatum: {{voucher_date}}</td><td>Liefer- / Leistungsdatum {{delivery_date}}</td><td>USt.-ID.: {{vat_id}}</td> 
	  </tr>
	</table>
      </div><!-- END of belegdetails-->
      
      <div id=positionstabelle>
	<table width=100% border=0><!-- only the tableheader one should have a border-->
	  <tr>
	    <th>Einheit</th><th>Ware / Leistung</th><th>Einzelpreis (netto)</th><th>MwSt.</th><th>Positionsrabatt</th><th>Summe (netto)</th>
		
	    {% for p in voucher_positions %}
	      <tr>
		<td>{{"%.2f" % p.amount}} {{p.unit.abbreviation}}</td><td>{{p.product_name}}</td><td>{{"%.2f" % p.net_price}} {{currency.symbol}}</td><td>{{p.tax_key.abbreviation}}</td><td>{% if p.position_discount > 0 %}{{"%.2f" % p.position_discount}} %{% endif %}</td><td>{{ "%.2f" % p.net_sum}} {{currency.symbol}}</td>    
	      </tr>
	    {% endfor %}
	  </table>
	  <table border = 0 align=right><!-- this one should have a border-->
	    <tr>
	      <td width=4cm>Summe</td><td width=4cm>{{"%.2f" % net_total}} {{currency.symbol}}</td>	   
	    </tr>
		{% for key, value in total_tax_values.iteritems() %}
		  <tr>
		    <td>zzgl. {{"%.2f" % key}} % MwSt.</td><td>{{"%.2f" % value}} {{currency.symbol}}</td>
		  </tr>
		{% endfor %}  
	    <tr>
	      <td><b>Rechnungsbetrag</b></td><td><b>{{"%.2f" % total}} {{currency.symbol}}</b></td>
	    </tr>
	    <tr><td><br></td></tr>
	    {% if shipping_method %}<tr><td>Versand als</td><td>{{shipping_method.label}}</td></tr>{% endif %}
	  </table>
	  
	</div><!-- END of positionstabelle-->
      
	<div id=post_text>
	  {% if payment_term_text %}<p>{{payment_term_text}}</p>{% endif %}
	  {% if post_text %}<p>{{post_text}}</p>{% endif %}
	</div><!-- post_texte-->
    {% endblock %}



  {% block page_footer %}
  
  <div id=footer>
    <table width=100%>
      <tr>
	<td>{{own_company_name}} {{own_legal_form}}<br>{{own_address1}}<br>{{own_zip}} {{own_citiy}}</td><td>Tel.:{{own_phone}}<br>Fax:{{own_fax}}<br>{{own_email}}<br>{{own_website}}</td><td>{{own_bank}}<br>IBAN: {{own_IBAN}}<br>BIC: {{own_BIC}}<br></td><td>{% if own_legal_info1 %}{{own_legal_info1}}<br>{% endif %}{% if own_legal_info2 %}{{own_legal_info2}}<br>{% endif %}{% if own_legal_info3 %}{{own_legal_info3}}<br>{% endif %}</td>
      </tr>
    </table>
  </div>

  {% endblock %}
</div>
